package com.example.sbbsec.domain.stat.common;

import com.google.common.base.MoreObjects;
import lombok.Getter;
import lombok.Setter;
import org.springframework.data.annotation.Id;
import org.springframework.data.elasticsearch.annotations.Document;

import java.util.Date;

import static com.google.common.base.Strings.isNullOrEmpty;

/**
 * 考生报考信息
 */
@Getter
@Setter
@Document(indexName="syzkmis-view",shards=1,replicas=0,refreshInterval="-1")
public final class ExamRegistration {
    private static final long serialVersionUID = 7104447799641205432L;
    @Id
    private Long id;
    private String updatedUser;
    private String createdUser;
    private Long updatedUserId;
    private Long createdUserId;
    private Date updatedTime;
    private Date createdTime;

    private Long planId; // 所属计划ID
    private Long examineeRegistrationId; // 考生注册信息ID
    private Long jobId;// 报考岗位ID
    private Long majorRequirementId;
    private Long subordinateRequirementId;//
    private String registrationNo; // 考生报名号
    private String similarSpecialized; // 相似专业
    private Long similarSpecializedMark; // 相似专业标志 0 否 1 是
    private String similarSpecializedOpinion; // 相似专业审核意见
    private Long similarSpecializedAudit;//相似专业审核状态id
    private String similarSpecializedAuditName;//相似专业审核状态名称
    private Long genderId; // 性别
    private String genderName; // 性别
    private String nation; // 民族
    private String houseHold; // 户籍
    private String houseHoldName; // 户籍名称
    private String idCard; // 身份证号码
    private String birthday; // 出生年月
    private String political; // 政治面貌
    private String duty; // 职务(职称)
    private String unit; // 工作单位
    private String address; // 通讯地址
    private String zipCode; // 邮编
    private String firstPhone; // 联系电话1
    private String secondPhone; // 联系电话2
    private String graduateSchool; // 毕业学校
    private String specialty; // 所学专业
    private Long educationId; // 学历ID
    private String educationName;//学历名称
    private String graduateTime; // 毕业时间
    private String studentSource; // 生源地
    private String studentSourceName; // 生源地名称
    private String workStartTime; // 参加工作时间
    private String workSeniority; // 实际工作年限
    private String foreignLanguage; // 掌握何种外语及程度
    private String computer; // 计算机掌握程度
    private String avoidrelationship; // 报考岗位是否存在回避关系
    private String statusName;//审核状态
    private String unitName;//招考单位名称
    private Integer particular;//是否特殊情况 0否 1是


    private Integer year;
    private String jobName;
    private String jobCode;
    private Double writtenScore;
    private Integer strengthResult;
    private Double interviewScore;
    private Double bonusScore;
    private Integer paymentStatus;
    private Double skillScore;
    private String subName;
    private Integer cancelMark;
    private Integer statusId; //审核状态
    private String admissionNo;
    private String allName;
    private String idPhoto;
    private String jobType;
    private String examAddress;
    private Integer classRoomNo;
    private String jobSpecialty;
    private Long safe;  //是否符合安置条件
    private String safeName; //安置条件名称
    private Boolean abroad;//是否归国人员留学人员
    private String safeDescribe;//安置条件描述
    private Boolean checkEdcationMark;//是否研究生以本科学历报考标志


    private String changeJobName;
    private String changeUnitName;
    private String changeJobCode;
    private String changeJobSpecialty;
    private String otherrequirements;
    private String jobEducationName;
    private String bonusName;
    private String bonusRuleTypeIds;
    private String accountIds;//待审数据，审核人的id
    private Date updateTime;//考生提交时间


    //省份编码
    private String provinceCode;
    //年龄范围
    private String ageRange;


    public String getProvinceCode() {
        if (!isNullOrEmpty(houseHold) && houseHold.length() >=2) {
            return houseHold.substring(0, 2);
        }
        if (!isNullOrEmpty(studentSource) && studentSource.length() >=2) {
            return studentSource.substring(0, 2);
        }
        return "";
    }

    public void setProvinceCode(String provinceCode) {
        this.provinceCode = provinceCode;
    }

    public String getAgeRange() {
        return ageRange;
    }

    public void setAgeRange(String ageRange) {
        this.ageRange = ageRange;
    }


    @Override
    public String toString() {
        return MoreObjects.toStringHelper(this)
                .add("id", id)
                .add("updatedUser", updatedUser)
                .add("createdUser", createdUser)
                .add("updatedUserId", updatedUserId)
                .add("createdUserId", createdUserId)
                .add("updatedTime", updatedTime)
                .add("createdTime", createdTime)
                .add("planId", planId)
                .add("examineeRegistrationId", examineeRegistrationId)
                .add("jobId", jobId)
                .add("majorRequirementId", majorRequirementId)
                .add("subordinateRequirementId", subordinateRequirementId)
                .add("registrationNo", registrationNo)
                .add("similarSpecialized", similarSpecialized)
                .add("similarSpecializedMark", similarSpecializedMark)
                .add("similarSpecializedOpinion", similarSpecializedOpinion)
                .add("similarSpecializedAudit", similarSpecializedAudit)
                .add("similarSpecializedAuditName", similarSpecializedAuditName)
                .add("genderId", genderId)
                .add("genderName", genderName)
                .add("nation", nation)
                .add("houseHold", houseHold)
                .add("houseHoldName", houseHoldName)
                .add("idCard", idCard)
                .add("birthday", birthday)
                .add("political", political)
                .add("duty", duty)
                .add("unit", unit)
                .add("address", address)
                .add("zipCode", zipCode)
                .add("firstPhone", firstPhone)
                .add("secondPhone", secondPhone)
                .add("graduateSchool", graduateSchool)
                .add("specialty", specialty)
                .add("educationId", educationId)
                .add("educationName", educationName)
                .add("graduateTime", graduateTime)
                .add("studentSource", studentSource)
                .add("studentSourceName", studentSourceName)
                .add("workStartTime", workStartTime)
                .add("workSeniority", workSeniority)
                .add("foreignLanguage", foreignLanguage)
                .add("computer", computer)
                .add("avoidrelationship", avoidrelationship)
                .add("statusName", statusName)
                .add("unitName", unitName)
                .add("particular", particular)
                .add("year", year)
                .add("jobName", jobName)
                .add("jobCode", jobCode)
                .add("writtenScore", writtenScore)
                .add("strengthResult", strengthResult)
                .add("interviewScore", interviewScore)
                .add("bonusScore", bonusScore)
                .add("paymentStatus", paymentStatus)
                .add("skillScore", skillScore)
                .add("subName", subName)
                .add("cancelMark", cancelMark)
                .add("statusId", statusId)
                .add("admissionNo", admissionNo)
                .add("allName", allName)
                .add("idPhoto", idPhoto)
                .add("jobType", jobType)
                .add("examAddress", examAddress)
                .add("classRoomNo", classRoomNo)
                .add("jobSpecialty", jobSpecialty)
                .add("safe", safe)
                .add("safeName", safeName)
                .add("abroad", abroad)
                .add("safeDescribe", safeDescribe)
                .add("checkEdcationMark", checkEdcationMark)
                .add("changeJobName", changeJobName)
                .add("changeUnitName", changeUnitName)
                .add("changeJobCode", changeJobCode)
                .add("changeJobSpecialty", changeJobSpecialty)
                .add("otherrequirements", otherrequirements)
                .add("jobEducationName", jobEducationName)
                .add("bonusName", bonusName)
                .add("bonusRuleTypeIds", bonusRuleTypeIds)
                .add("accountIds", accountIds)
                .add("updateTime", updateTime)
                .add("provinceCode", provinceCode)
                .add("ageRange", ageRange)
                .toString();
    }
}
